package com.woniuxy.micropurchaseserver.configure;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SpringMVCConfigure implements WebMvcConfigurer {
    /**
     * 跨域支持
     * @param registry
     */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")//允许所有的请求
                .allowCredentials(true).//允许做身份认证
                allowedMethods("GET","POST","PUT","DELETE");//允许支持的跨域方法有哪些
    }
}
